var t = require("../../utils/util.js"), a = getApp();

Page({
    data: {
        selectArea: !1,
        imagewidth: 0,
        imageheight: 0,
        nickName: "",
        avatarUrl: "",
        showButton1: !1,
        showButton2: !0,
        baseUrl: a.globalData.baseUrl,
        banners: [],
        store: {},
        serverList: [],
        goodsList: [],
        group: {}
    },
    imageLoad: function(a) {
        var o = t.imageUtil(a);
        this.setData({
            imagewidth: o.imageWidth,
            imageheight: o.imageHeight
        });
    },
    showbutton1: function() {
        var t = this;
        0 == t.data.showButton2 ? t.setData({
            showButton2: !t.data.showButton2,
            showButton1: !t.data.showButton1
        }) : t.setData({
            showButton1: !1
        });
    },
    showbutton2: function() {
        var t = this;
        0 == t.data.showButton1 ? t.setData({
            showButton1: !t.data.showButton1,
            showButton2: !t.data.showButton2
        }) : t.setData({
            showButton2: !1
        });
    },
    onLoad: function(t) {
        this.setData({
            id: t.id
        });
        var o = a.globalData.urlBase + a.globalData.urlGrupDetail;
        this.getinitData(o);
    },
    getinitData: function(t) {
        var o = this;
        wx.request({
            url: t,
            data: {
                lng: a.globalData.lng,
                lat: a.globalData.lat,
                tuanId: o.data.id
            },
            method: "POST",
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            success: function(t) {
                var a = JSON.parse(t.data);
                0 != a.code ? wx.showToast({
                    title: a.msg,
                    icon: "none",
                    duration: 2e3
                }) : o.setData({
                    store: a.store,
                    group: a.tuan,
                    banners: a.tuan.imgs.split(","),
                    serverList: a.serverList,
                    shareName: a.tuan.name,
                    shareImg: a.tuan.imgs.split(",")[0] ? a.tuan.imgs.split(",")[0] : ""
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    openMap: function() {
        var t = this;
        wx.openLocation({
            latitude: parseFloat(t.data.store.lat),
            longitude: parseFloat(t.data.store.lng),
            name: t.data.store.name,
            address: t.data.store.address
        });
    },
    goServerDetail: function(t) {
        var a = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "../index/detail?id=" + a
        });
    },
    goDetail: function() {
        var t = this;
        wx.navigateTo({
            url: "../product/detail?id=" + t.data.id
        });
    },
    onShareAppMessage: function(t) {
        var a = this;
        return "button" === t.from ? (console.log("来自页面内转发按钮"), console.log(t.target)) : console.log("来自右上角转发菜单"), 
        {
            title: a.data.shareName,
            imageUrl: a.data.baseUrl + "download?id=" + a.data.shareImg,
            success: function(t) {
                console.log("转发成功", t);
            },
            fail: function(t) {
                console.log("转发失败", t);
            }
        };
    }
});